<div class="popup">
	<div class="header">
		<i class="icon_w icon_friend"></i>
		修改好友昵称
		<i class="icon_w icon_close" style="float:right; cursor:pointer;" onclick="UM_LAYER.close();"></i>
	</div>
	<div id="div_edit_friend" class="content">
		<div style="margin-bottom:10px;">
			<input class="input" type="text" name="nickname" id="nickname" value="<{$friend.nickname}>" style="width:200px;" maxlength="20">
		</div>
		<div style="text-align:right;">
			<button class="submit" onclick="edit_friend();">确定</button>
			<button class="cancel" onclick="UM_LAYER.close();">取消</button>
		</div>
	</div>
</div>
<script language="javascript" type="text/javascript">
function edit_friend () {
	var id 		= '<{$friend.id}>';
	var nickname 	= $('#nickname').val();
	
	if (nickname == '<{$friend.nickname}>') {			// 没有修改
		UM_LAYER.close();
	} else {
		nickname = encodeURIComponent(nickname);
		loadMod('friend/action_edit', {'id':id, 'nickname':nickname}, '', function(msg){
			if (msg == 'true') {
				UM_LAYER.close();
				location.reload();
			} else {
				$('#div_edit_friend').html('<div style="padding:20px 50px; color:red;">操作失败</div>');
			}
		});
	}
}
</script>